#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 10
void find_two_largest(int a[], int n, int *largest, int *second_largest);
int main(void)
{
    srand((unsigned) time(NULL));
    int a[N], l1, l2;
    for (int i = 0; i < N; i++)
        a[i] = rand() % 100;
    for (int i = 0; i < N; i++)
        printf("%s%d%s", i ? ", " : "", a[i], N - 1 - i ? "" : "\n");
    find_two_largest(a, N, &l1, &l2);
    printf("%d %d\n", l1, l2);
    return 0;
}
void find_two_largest(int a[], int n, int *largest, int *second_largest) {
    if (n == 1) {
        *largest = *second_largest = a[0];
        return;
    }
    if (a[0] > a[1]) {
        *largest = a[0];
        *second_largest = a[1];
    } else {
        *largest = a[1];
        *second_largest = a[0];
    }
    for (int i = 2; i < n; i++) {
        if (a[i] > *second_largest)
            if (a[i] > *largest) {
                *second_largest = *largest;
                *largest = a[i];
            } else
                *second_largest = a[i];
    }
}